<?php
class Navi_Model_Position
{
    public function get($path)
    {
        $courseElements = array();
        $breadcrumb = array();

        $course = new Navi_Model_Course();
        $courseElements = $course->getRenderPath($path);

        $config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/modules/navi/navigation.xml', 'navi');
        $navi = $config->toArray();

        while (count($courseElements) != 0) {

            $breadcrumb['page'][] = implode(".", $courseElements);

            $courseElementsTemp = $courseElements;
            if (count($courseElements) > 1)
                for ($i = 0; $i < (count($courseElements)-1);$i++)
                    $courseElementsTemp[$i] .= '-subnavi';

            $bodytag = '["'.str_replace('.', '"]["', implode(".", $courseElementsTemp)).'"]';

            eval("\$breadcrumb['label'][] = \$navi".$bodytag.";");
            array_pop($courseElements);
        }
        $position = array();

        $position['label'] = array_reverse($breadcrumb['label']);
        $position['page'] = array_reverse($breadcrumb['page']);

        return $position;
    }
}